package com.mmy.service.oa.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.mmy.dao.oa.MaterialBaseRepository;
import com.mmy.domain.oa.MaterialBase;
import com.mmy.service.oa.MaterialBaseService;

@Service
public class MaterialBaseServiceImpl implements MaterialBaseService {

	@Autowired
	private MaterialBaseRepository materialBaseRepository;

	/**
	 * 查找全部
	 * 
	 * @param
	 * @return
	 */
	public List<MaterialBase> findAll() {
		// TODO Auto-generated method stub
		return materialBaseRepository.findAll();
	}

	/**
	 * 获取最大值
	 * 
	 * @param
	 * @return
	 */

	public Object getMaxMaterialID() {
		// TODO Auto-generated method stub
		return materialBaseRepository.getMaxMaterialID();
	}

	/**
	 * 根据名称查找
	 * 
	 * @param
	 * @return
	 */
	public List<MaterialBase> findByMaterialName(String strMaterialName) {
		// TODO Auto-generated method stub
		return materialBaseRepository.findByMaterialName(strMaterialName);
	}

	/**
	 * 新增
	 * 
	 * @param
	 * @return
	 */
	public MaterialBase save(MaterialBase materialBase) {
		// TODO Auto-generated method stub
		return materialBaseRepository.save(materialBase);
	}

	/**
	 * 删除
	 * 
	 * @param
	 * @return
	 */
	public void delMaterialBase(List<Integer> lstMaterialID) {
		// TODO Auto-generated method stub
		materialBaseRepository.delMaterialBase(lstMaterialID);
	}

	/**
	 * 通过id查找
	 * 
	 * @param
	 * @return
	 */
	public MaterialBase findByMaterialID(int iMaterialID) {
		// TODO Auto-generated method stub
		return materialBaseRepository.findByMaterialID(iMaterialID);
	}


	/**
	 * 查询数量
	 * 
	 * @param
	 * @return
	 */
	public int getNumberByMaterialID(int iMaterialID) {
		// TODO Auto-generated method stub
		return materialBaseRepository.getNumberByMaterialID(iMaterialID);
	}

	/**
	 * 通过id找name
	 * 
	 * @param
	 * @return
	 */
	public String findMaterialNameByMaterialID(int iMaterialID) {
		// TODO Auto-generated method stub
		return materialBaseRepository.findMaterialNameByMaterialID(iMaterialID);
	}

	/**
	 * 通过id修改number
	 * 
	 * @param
	 * @return
	 */
	public void updateNumberByMaterialID(int iNumber, int iMaterialID) {
		// TODO Auto-generated method stub
		materialBaseRepository.updateNumberByMaterialID(iNumber, iMaterialID);
	}

	/**
	 * 新增id
	 * 
	 * @param
	 * @return
	 */
	public void save(int materialID) {
		// TODO Auto-generated method stub
		materialBaseRepository.save(materialID);
	}

}
